package com.fanqwz.hexieshe.dagger.module;

import android.app.Application;
import android.content.Context;

import com.fanqwz.hexieshe.JobExecutor;
import com.fanqwz.hexieshe.dagger.UIThread;
import com.fanqwz.hexieshe.dagger.component.ApplicationComponent;
import com.fanqwz.hexieshe.data.HXSRepository;
import com.fanqwz.hexieshe.domain.executor.PostExecutionThread;
import com.fanqwz.hexieshe.domain.repository.Repository;

import java.util.concurrent.Executor;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/**
 * Created by fanqw on 2017/6/30.
 */

@Module
public class ApplicationModule {
    private final Application application;
    private ApplicationComponent applicationComponent;

    public ApplicationModule(Application application) {
        this.application = application;
    }

    @Provides
    @Singleton
    Context provideApplicationContext() {
        return application;
    }

    @Provides
    @Singleton
    Executor provideExecutor(JobExecutor executor) {
        return executor;
    }

    @Provides
    @Singleton
    PostExecutionThread providePostExecutionThread(UIThread thread) {
        return thread;
    }

    @Provides
    @Singleton
    Repository provideRepository(HXSRepository repository) {
        return repository;
    }
}
